package com.itheima.sh.consumer.client;
import com.itheima.sh.consumer.client.fallback.UserFeignApiFallback;
import com.itheima.sh.consumer.config.FeignConfig;
import com.itheima.sh.consumer.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

// 声明当前接口是feign的客户端  并指明要调用的服务  user-service
@FeignClient(value = "user-service"
        ,fallback = UserFeignApiFallback.class
        ,configuration = FeignConfig.class)
public interface UserFeignApi {
    @GetMapping("user/{id}")
    public User queryById(@PathVariable("id") String id);
    @PostMapping("user")
    public String save(@RequestBody User user);
}
